<%page args="section_data" expression_filter="h"/>
<%!
from django.utils.translation import gettext as _
from openedx.core.djangolib.markup import HTML, Text
%>

%if settings.FEATURES.get('DISPLAY_ANALYTICS_ENROLLMENTS') or section_data.get('enrollment_message'):
  <h4 class="hd hd-4">${_("Enrollment Information")}</h4>
  <div class="enrollment-wrapper">
    %if settings.FEATURES.get('DISPLAY_ANALYTICS_ENROLLMENTS'):
      ## Translators: 'track' refers to the enrollment type ('honor', 'verified', or 'audit')
      <% modes = section_data['enrollment_count'] %>
        <table>
            <caption class="tip">${_("Number of enrollees (admins, staff, and students) by track")}</caption>
            <tr>
                <th scope="row">${_("Verified")}</th><td>${modes['verified']}</td>
            </tr>
            <tr>
                <th scope="row">${_("Audit")}</th><td>${modes['audit']}</td>
            </tr>
            <tr>
                <th scope="row">${_("Honor")}</th><td>${modes['honor']}</td>
            </tr>
            <tr>
                <th scope="row">${_("Professional")}</th><td>${modes['professional'] + modes['no-id-professional']}</td>
            </tr>
            %if modes["executive-education"] > 0:
              <tr>
                  <th scope="row">${_("Executive Education")}</th><td>${modes['executive-education']}</td>
              </tr>
            %endif
            %if modes["unpaid-executive-education"] > 0:
              <tr>
                  <th scope="row">${_("Unpaid Executive Education")}</th><td>${modes['unpaid-executive-education']}</td>
              </tr>
            %endif
            %if modes["paid-executive-education"] > 0:
              <tr>
                  <th scope="row">${_("Paid Executive Education")}</th><td>${modes['paid-executive-education']}</td>
              </tr>
            %endif
            %if modes['masters'] > 0:
                <tr>
                    <th scope="row">${_("Master's")}</th><td>${modes['masters']}</td>
                </tr>
            %endif
            %if modes["unpaid-bootcamp"] > 0:
              <tr>
                  <th scope="row">${_("Unpaid Bootcamp")}</th><td>${modes['unpaid-bootcamp']}</td>
              </tr>
            %endif
            %if modes["paid-bootcamp"] > 0:
              <tr>
                  <th scope="row">${_("Paid Bootcamp")}</th><td>${modes['paid-bootcamp']}</td>
              </tr>
            %endif
            <tr style="color:green;border-top:1px solid #000">
                <th scope="row" style="padding-top:10px;">
                    <strong>${_("Total")}</strong>
                </th>
                <td style="padding-top:10px;">
                    <strong>${modes['total']}</strong>
                </td>
            </tr>
        </table>
      %elif section_data.get('enrollment_message'):
        <p>${section_data['enrollment_message']}</p>
      %endif
  </div>
  <hr>
%endif

<div class="basic-wrapper">
  <h4 class="hd hd-4">${_("Basic Course Information")}</h4>

  <ul class="list-input">
    <li class="field text is-not-editable" id="field-course-display-name">
      <label for="course-display-name">${_("Course Name:")}</label>
      <b>${ section_data['course_display_name']}</b>
    </li>

    <li class="field text is-not-editable" id="field-course-name">
      <label for="course-name">${_("Course Run:")}</label>
      <b>${ section_data['course_id'].run}</b>
    </li>

    <li class="field text is-not-editable" id="field-course-number">
      <label for="course-number">${_("Course Number:")}</label>
      <b>${ section_data['course_number']}</b>
    </li>

    <li class="field text is-not-editable" id="field-course-organization">
      <label for="course-organization">${_("Organization:")}</label>
      <b>${ section_data['course_org']}</b>
    </li>

    <li class="field text is-not-editable" id="field-course-start-date">
      <label for="course-start-date">${_("Course Start Date:")}</label>
      <b class="localized-datetime" data-datetime="${section_data['start_date']}" data-timezone="${user_timezone}" data-language="${user_language}"></b>
    </li>

    <li class="field text is-not-editable" id="field-course-end-date">
      <label for="course-end-date">${_("Course End Date:")}</label>
        % if course.end is None:
            <b>${_("No end date set")}</b>
        % else:
            <b class="localized-datetime" data-datetime="${section_data['end_date']}" data-timezone="${user_timezone}" data-language="${user_language}"></b>
        % endif
    </li>
    <li class="field text is-not-editable" id="field-course-started">
      <label for="start-date">${_("Has the course started?")}</label>

      <b>${_("Yes") if section_data['has_started'] else _("No")}</b>

    </li>

    <li class="field text is-not-editable" id="field-course-ended">
      <label for="start-date">${_("Has the course ended?")}</label>
      %if section_data['has_ended']:
      <b>${_("Yes")}</b>
      %else:
      <b>${_("No")}</b>
      %endif
    </li>

    <li class="field text is-not-editable" id="field-course-num-sections">
      <label for="course-num-sections">${_("Number of sections:")}</label>
      <b>${ section_data['num_sections'] }</b>
    </li>

    <li class="field text is-not-editable" id="field-grade-cutoffs">
      <label for="start-date">${_("Grade Cutoffs:")}</label>
      <b>${ section_data['grade_cutoffs'] }</b>
    </li>
  </ul>

</div>

%if settings.FEATURES.get('ENABLE_INSTRUCTOR_BACKGROUND_TASKS'):
  <div class="running-tasks-container action-type-container">
    <hr>
    <h4 class="hd hd-4"> ${_("Pending Tasks")} </h4>
    <div class="running-tasks-section">
      <p>${_("The status for any active tasks appears in a table below.")} </p>
      <br />

      <div class="running-tasks-table" data-endpoint="${ section_data['list_instructor_tasks_url'] }"></div>
    </div>
    <div class="no-pending-tasks-message"></div>
  </div>

%endif

%if len(section_data['course_errors']):
  <div class="course-errors-wrapper">
    <hr>
    <p>
    <div class="toggle-wrapper">
      <h4 class="hd hd-4 title">${_("Course Warnings")}:</h4>
      <div class="triangle"></div>
    </div>
    <div class="course-errors-visibility-wrapper">
      %for error in section_data['course_errors']:
        <div class="course-error">
          <code class=course-error-first>  ${ error[0] } </code><br>
          <code class=course-error-second> ${ error[1] } </code>
        </div>
      %endfor
    </div>
    <p>
  </div>
<br>
%endif
